import Vue from 'vue'; // 引入 Vue
import store from './store';
import router from './router';
import {
  Button, Form, FormItem, Input, Container, Header, Menu, MenuItem, Submenu, Avatar, Dialog, Main, Table,
  TableColumn, Divider, Link, Backtop, Descriptions, DescriptionsItem, Tag, Aside, MenuItemGroup, Icon, Message
} from 'element-ui';
import * as API from './api';
import App from './App.vue'; // 引入 App 组件，它是所有组件的父组件

Vue.config.productionTip = false; // 关闭 Vue 生产提示

Vue.component(Divider.name, Divider);
// 使用插件
Vue.use(Table).use(TableColumn);
Vue.use(Link).use(Avatar).use(Dialog).use(Backtop);
Vue.use(Form).use(FormItem).use(Button).use(Input);
Vue.use(Container).use(Header).use(Main).use(Aside);
Vue.use(Menu).use(MenuItem).use(Submenu).use(MenuItemGroup);
Vue.use(Descriptions).use(DescriptionsItem).use(Tag).use(Icon);

// 创建 Vue 实例对象 --- vm
new Vue({
  store,
  router,
  render: h => h(App),
  beforeCreate: () => {
    Vue.prototype.$bus = this; // 全局事件总线 $bus 配置
    Vue.prototype.$API = API;
    Vue.prototype.$message = Message;
  },
}).$mount('#app')
